﻿using ScriptCoreLib;
using ScriptCoreLib.ActionScript;
using ScriptCoreLib.ActionScript.Extensions;
using ScriptCoreLib.ActionScript.flash.display;
using ScriptCoreLib.ActionScript.flash.text;
using ScriptCoreLib.ActionScript.flash.filters;
using com.brokenfunction.doom;

namespace Doomedonline
{
	/// <summary>
	/// Default flash player entrypoint class. See 'tools/build.bat' for adding more entrypoints.
	/// </summary>
	[Script, ScriptApplicationEntryPoint(WithResources = true)]
	[SWF(width = 320 * 2, height = 200 * 2, frameRate = 35)]
	public class Application : Sprite
	{
		public Application()
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			//stage.quality = StageQuality.LOW;
			scaleX = 2;
			scaleY = 2;
			//scaleX = scaleY = 3;

			var wad = KnownEmbeddedResources.Default["assets/Doomedonline/doom1-shareware.wad"].ToByteArrayAsset();

			new DoomCore(this, wad);


			new TextField
			{
				width = 600,
				height = 400,
				x = 20,
				y = 20,
				defaultTextFormat = new TextFormat
				{
					size = 8,
					color = 0xff,
					font = "Verdana"
				},
				text = "powered by jsc",

				filters = new BitmapFilter[] { new DropShadowFilter() },
			}.AttachTo(this);


			KnownEmbeddedResources.Default["assets/Doomedonline/jsc.png"].ToBitmapAsset().AttachTo(this).MoveTo(
				320 - 96 * 2, 
				200 - 96 * 2);
		}


	}

}